/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 700;
    transition: transform 0.1s ease, color 0.3s ease;
}

.subtitle {
    font-size: 1.1em;
    color: #666;
    font-weight: 300;
}

/* 搜索框样式 */
.search-section {
    margin-bottom: 40px;
    padding: 30px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 20px;
}

.search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    font-size: 16px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    background: #fff;
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.search-input::placeholder {
    color: #999;
    font-style: italic;
}

.clear-search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    display: none;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.clear-search-btn:hover {
    background: #ff5252;
    transform: translateY(-50%) scale(1.1);
}

.search-stats {
    text-align: center;
    color: #666;
    font-size: 14px;
}

.search-stats #totalCount {
    color: #667eea;
    font-weight: bold;
    font-size: 16px;
}

/* 搜索错误样式 */
.search-error {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.search-error p {
    font-size: 18px;
    margin-bottom: 20px;
}

.retry-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

/* 网格布局 */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* 卡片样式 */
.item-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 280px;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.item-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: #f0f0f0;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.item-card:hover .item-image img {
    transform: scale(1.05);
}

.item-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.item-title {
    font-size: 1.15em;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
}

.item-description {
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
    flex: 1;
    font-size: 0.92em;
}

/* 下载区域 */
.download-section {
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
    margin-top: auto;
}

.download-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.download-btn {
    flex: 1;
    min-width: 85px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.85em;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

.download-btn:not(.disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.download-btn.disabled {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
}

/* 显示下载按钮 */
.show-download-section {
    margin-bottom: 8px;
}

.show-download-btn {
    padding: 10px 24px;
    background: #50c878;
    color: white;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.88em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(80, 200, 120, 0.3);
    white-space: nowrap;
    width: 100%;
    max-width: 140px;
}

.show-download-btn:hover {
    background: #45b369;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(80, 200, 120, 0.4);
}

.show-download-btn:active {
    transform: translateY(0);
}

.show-download-btn.loading {
    opacity: 0.6;
    cursor: wait;
}

.show-download-btn.unlocked {
    background: #888;
    cursor: default;
}

.show-download-btn.unlocked:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(80, 200, 120, 0.3);
}

/* 公开资源标签 */
.public-label {
    color: #50c878;
    font-weight: 500;
    font-size: 0.85em;
    text-align: center;
    padding: 10px 18px;
    background: rgba(80, 200, 120, 0.1);
    border-radius: 18px;
    border: 1px solid #50c878;
    display: inline-block;
    width: 100%;
    max-width: 200px;
}

/* 下载链接显示区域 */
.download-links {
    margin-top: 10px;
}

.link-item {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.link-item:last-child {
    margin-bottom: 0;
}

.link-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.link-content {
    display: flex;
    gap: 10px;
    align-items: center;
}

.link-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
    background: white;
    color: #333;
    transition: border-color 0.3s ease;
}

.link-input:focus {
    outline: none;
    border-color: #667eea;
}

.link-input:hover {
    border-color: #667eea;
}

.copy-link-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.copy-link-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.copy-link-btn:active {
    transform: translateY(0);
}


@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 密码验证弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 25px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3em;
}

.close-modal {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    padding: 30px 25px;
}

.modal-tip {
    color: #666;
    margin-bottom: 20px;
    text-align: center;
}

.password-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1em;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.3s ease;
    text-align: center;
    letter-spacing: 2px;
    font-weight: 600;
}

.password-input:focus {
    outline: none;
    border-color: #667eea;
}

.error-message {
    color: #e74c3c;
    margin-top: 15px;
    text-align: center;
    font-size: 0.9em;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.cancel-btn {
    background: #f0f0f0;
    color: #666;
}

.cancel-btn:hover {
    background: #e0e0e0;
}

.confirm-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.confirm-btn:active {
    transform: translateY(0);
}

/* 页脚 */
footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 0;
    text-align: center;
    margin-top: 60px;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
}

footer .copyright {
    color: #666;
    margin-bottom: 15px;
}

footer .author-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

footer .author-info p {
    color: #667eea;
    font-weight: 500;
    margin: 5px 0;
}

footer .contact {
    cursor: pointer;
    transition: all 0.3s ease;
}

footer .contact:hover {
    color: #764ba2;
    transform: scale(1.05);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .search-section {
        margin-bottom: 30px;
        padding: 20px 0;
    }
    
    .search-container {
        max-width: 100%;
        margin: 0 15px 15px;
    }
    
    .search-input {
        padding: 12px 45px 12px 15px;
        font-size: 14px;
    }
    
    .clear-search-btn {
        right: 12px;
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .search-stats {
        font-size: 12px;
    }
    
    .search-stats #totalCount {
        font-size: 14px;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 15px;
        padding: 15px;
    }
    
    .item-card {
        margin: 0 auto;
        max-width: 350px;
        min-height: 260px;
    }
    
    .item-image {
        height: 120px;
    }
    
    .item-content {
        padding: 12px;
    }
    
    .item-description {
        font-size: 0.9em;
    }

    header h1 {
        font-size: 2em;
    }

    .item-title {
        font-size: 1.3em;
    }

    .download-buttons {
        flex-direction: column;
    }

    .download-btn {
        width: 100%;
        min-width: 100%;
    }

    .show-download-btn {
        max-width: 100%;
    }

    footer .author-info {
        flex-direction: column;
        gap: 10px;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 15px 20px;
        flex-direction: column-reverse;
    }

    .modal-btn {
        width: 100%;
    }

    .link-content {
        flex-direction: column;
        align-items: stretch;
    }

    .copy-link-btn {
        width: 100%;
    }

    .link-input {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .items-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .item-card {
        max-width: 100%;
        min-height: 240px;
    }
    
    .item-image {
        height: 100px;
    }
}